package com.prd.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.prd.config.LoginInterceptor;
import com.prd.constant.CheckStatus;
import com.prd.mapper.EntMeetSummaryApproveMapper;
import com.prd.model.EntMeetSummaryApprove;
import com.prd.model.LoginUser;
import com.prd.service.EntMeetSummaryApproveService;
import com.prd.util.UserInfoUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EntMeetSummaryApproveServiceImpl extends ServiceImpl<EntMeetSummaryApproveMapper, EntMeetSummaryApprove> implements EntMeetSummaryApproveService {

    @Autowired
    private EntMeetSummaryApproveMapper entMeetSummaryApproveMapper;

    @Override
    public int insertInfo(EntMeetSummaryApprove entMeetSummaryApprove) {
        LoginUser loginUser = LoginInterceptor.threadLocal.get();
        BeanUtils.copyProperties(UserInfoUtil.recordInfo(loginUser.getId(), loginUser.getName(), true), entMeetSummaryApprove);
        return entMeetSummaryApproveMapper.insert(entMeetSummaryApprove);
    }

    @Override
    public int updateInfo(EntMeetSummaryApprove entMeetSummaryApprove) {
        LoginUser loginUser = LoginInterceptor.threadLocal.get();
        BeanUtils.copyProperties(UserInfoUtil.recordInfo(loginUser.getId(), loginUser.getName(), false), entMeetSummaryApprove);
        return entMeetSummaryApproveMapper.updateById(entMeetSummaryApprove);
    }
}
